<template>
  <div>
    <home-header :titles="headerTitle"></home-header>
    <home-swiper :swiperData="swiperData"></home-swiper>
    <home-detail :detailData="detailData"></home-detail>
    <home-tail :tailData="tailData"></home-tail>
  </div>
</template>

<script>
import axios from 'axios'
import HomeHeader from './components/Header'
import HomeSwiper from './components/Swiper'
import HomeDetail from './components/Detail'
import HomeTail from './components/Tail'
export default {
  name: 'Home',
  components: {
    HomeHeader,
    HomeSwiper,
    HomeDetail,
    HomeTail
  },
  data () {
    return {
      headerTitle: '',
      swiperData: {},
      detailData: {},
      tailData: {}
    }
  },
  methods: {
    getHomeInfo () {
      axios.get('api/home.json')
        .then(this.handleGetHomeInfoSucc)
    },
    handleGetHomeInfoSucc (res) {
      res = res.data
      if (res.ret && res.data) {
        const data = res.data
        this.headerTitle = data.headerTitle
        this.swiperData = data.swiperData
        this.detailData = data.detailData
        this.tailData = data.tailData
      }
    }
  },
  mounted () {
    this.getHomeInfo()
  }
}
</script>

<style>

</style>
